import cv2
import numpy as np

height, width, channel, dtype = 512, 512, 3, np.uint8
blank_image = np.zeros((height, width, channel), dtype=dtype)

# 直线的起点坐标和终点坐标
pt1, pt2 = (0, 0), (512, 512)
# 直线的颜色和粗细
color, thickness = (91, 137, 254), 2
# 绘制直线
cv2.line(blank_image, pt1, pt2, color, thickness)

cv2.imshow('直线', blank_image)

cv2.waitKey(0)
cv2.destroyAllWindows()
